﻿<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:UIElements="clr-namespace:Emcc.ScrumMastersWorkbench.UIElements;assembly=Emcc.ScrumMastersWorkbench.UIElements" xmlns:Helpers="clr-namespace:Emcc.ScrumMastersWorkbench.Core.Helpers;assembly=Emcc.ScrumMastersWorkbench.Core">
    
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="GridTemplates.xaml" />
        <ResourceDictionary Source="/Emcc.ScrumMastersWorkbench.UIElements;Component/Resources/CommandButtonStyles.xaml"/>
    </ResourceDictionary.MergedDictionaries>
    
    <SolidColorBrush x:Key="ListBorder" Color="#828790"/>
    
    <Style x:Key="ScrollViewerStyle" TargetType="{x:Type ScrollViewer}">
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                    <Grid SnapsToDevicePixels="true">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <DockPanel Margin="{TemplateBinding Padding}">
                            <ScrollViewer Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" DockPanel.Dock="Top">
                                <GridViewHeaderRowPresenter Margin="2,0,2,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" AllowsColumnReorder="{Binding TemplatedParent.View.AllowsColumnReorder, RelativeSource={RelativeSource TemplatedParent}}" ColumnHeaderContainerStyle="{DynamicResource GridViewColumnHeaderStyle1}" ColumnHeaderContextMenu="{Binding TemplatedParent.View.ColumnHeaderContextMenu, RelativeSource={RelativeSource TemplatedParent}}" ColumnHeaderStringFormat="{Binding TemplatedParent.View.ColumnHeaderStringFormat, RelativeSource={RelativeSource TemplatedParent}}" ColumnHeaderTemplate="{Binding TemplatedParent.View.ColumnHeaderTemplate, RelativeSource={RelativeSource TemplatedParent}}" ColumnHeaderTemplateSelector="{Binding TemplatedParent.View.ColumnHeaderTemplateSelector, RelativeSource={RelativeSource TemplatedParent}}" ColumnHeaderToolTip="{Binding TemplatedParent.View.ColumnHeaderToolTip, RelativeSource={RelativeSource TemplatedParent}}" Columns="{Binding TemplatedParent.View.Columns, RelativeSource={RelativeSource TemplatedParent}}"/>
                            </ScrollViewer>
                            <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" CanContentScroll="{TemplateBinding CanContentScroll}" KeyboardNavigation.DirectionalNavigation="Local"/>
                        </DockPanel>
                        <ScrollBar x:Name="PART_HorizontalScrollBar" Style="{DynamicResource ScrollBarStyle_MainContent}" Cursor="Arrow" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Grid.Row="1" Orientation="Horizontal" ViewportSize="{TemplateBinding ViewportWidth}" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0.0" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"/>
                        <ScrollBar x:Name="PART_VerticalScrollBar" Style="{DynamicResource ScrollBarStyle_MainContent}" Cursor="Arrow" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Grid.Column="1" Orientation="Vertical" ViewportSize="{TemplateBinding ViewportHeight}" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0.0" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"/>
                        <DockPanel Background="{Binding Background, ElementName=PART_VerticalScrollBar}" Grid.Column="1" Grid.Row="1" LastChildFill="false">
                            <Rectangle Fill="White" Width="1" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" DockPanel.Dock="Left"/>
                            <Rectangle Fill="White" Height="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" DockPanel.Dock="Top"/>
                        </DockPanel>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="ListViewStyle1" TargetType="{x:Type ListView}">
        <Setter Property="BorderBrush" Value="{StaticResource ListBorder}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Foreground" Value="#FF042271"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
        <Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="true" />
        <Setter Property="VirtualizingStackPanel.VirtualizationMode" Value="Recycling"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Background" Value="{StaticResource TransparentBackground1}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListView}">
                    <ScrollViewer Style="{DynamicResource ScrollViewerStyle}" Padding="{TemplateBinding Padding}">
                        <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                    </ScrollViewer>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsGrouping" Value="true">
                            <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemContainerStyle">
            <Setter.Value>
                <Style TargetType="{x:Type ListViewItem}">
                    <Setter Property="KeyboardNavigation.TabNavigation" Value="Cycle" />
                    <Setter Property="IsTabStop" Value="False" />
                    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type ListViewItem}">
                                <Border Background="#00ffffff">
                                    <Border.ToolTip>
                                        <UIElements:WorkbenchItemToolTip WorkbenchItem="{Binding WorkbenchItem}" />
                                    </Border.ToolTip>
                                    <Border.ContextMenu>
                                        <UIElements:WorkbenchItemContextMenu
                                            WorkbenchItem="{Binding WorkbenchItem}"
                                            ProjectData="{Binding Source={x:Static Helpers:ProjectDataHelper.CurrentProjectData}}"
                                            >
                                            <MenuItem
    							                CommandParameter="{Binding WorkbenchItem}" 
    							                Command="{x:Static UIElements:CommandLibrary.EditItem}"
    							                CommandTarget="{Binding PlacementTarget, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}"
                                                >
                                                <MenuItem.Icon>
                                                    <ContentControl Template="{StaticResource EditIconTemplate}" Style="{StaticResource MenuIconStyle}" />
                                                </MenuItem.Icon>
                                                <MenuItem.Header>
                                                    <TextBlock FontWeight="Bold">
					                                    <TextBlock.Text>
					                                        <MultiBinding StringFormat="{}Edit ({0}) {1}">
							                                    <Binding Path="WorkbenchItem[System.Id]" />
							                                    <Binding Path="WorkbenchItem[System.WorkItemType]"/>
						                                    </MultiBinding>
					                                    </TextBlock.Text>
                                                    </TextBlock>
                                                </MenuItem.Header>
                                            </MenuItem>
                                            <MenuItem 
    							                Header="Open In Browser"
    							                CommandParameter="{Binding WorkbenchItem}" 
    							                Command="{x:Static UIElements:CommandLibrary.OpenItemInBrowser}"
    							                CommandTarget="{Binding PlacementTarget, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}"
                                                >
                                                <MenuItem.Icon>
                                                    <ContentControl Template="{StaticResource WebIconTemplate}" Style="{StaticResource MenuIconStyle}" />
                                                </MenuItem.Icon>
                                            </MenuItem>
                                            <MenuItem 
    							                Header="Save Changes"
    							                CommandParameter="{Binding WorkbenchItem}" 
    							                Command="{x:Static UIElements:CommandLibrary.SaveItem}"
    							                CommandTarget="{Binding PlacementTarget, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}"
                                                >
                                                <MenuItem.Icon>
                                                    <ContentControl Template="{StaticResource SaveIconTemplate}" Style="{StaticResource MenuIconStyle}" />
                                                </MenuItem.Icon>
                                            </MenuItem>
                                            <MenuItem 
    							                Header="Refresh / Reset"
    							                CommandParameter="{Binding WorkbenchItem}" 
    							                Command="{x:Static UIElements:CommandLibrary.RefreshItem}"
    							                CommandTarget="{Binding PlacementTarget, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}"
                            	                >
                                                <MenuItem.Icon>
                                                    <ContentControl Template="{StaticResource RefreshIconTemplate}" Style="{StaticResource MenuIconStyle}" />
                                                </MenuItem.Icon>
                                            </MenuItem>
                                            <MenuItem 
    							                Header="Discard Unsaved Item"
    							                CommandParameter="{Binding WorkbenchItem}" 
    							                Command="{x:Static UIElements:CommandLibrary.DiscardItem}"
    							                CommandTarget="{Binding PlacementTarget, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}"
                                                >
                                                <MenuItem.Icon>
                                                    <ContentControl Template="{StaticResource DeleteIconTemplate}" Style="{StaticResource MenuIconStyle}" />
                                                </MenuItem.Icon>
                                            </MenuItem>
                                        </UIElements:WorkbenchItemContextMenu>
                                    </Border.ContextMenu>
                                    <GridViewRowPresenter VerticalAlignment="Stretch" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                                </Border>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>
    </Style>
    
    <LinearGradientBrush x:Key="GridViewColumnHeaderBackground" EndPoint="0,1" StartPoint="0,0">
        <GradientStop Color="#FFFFFFFF" Offset="0"/>
        <GradientStop Color="#FFFFFFFF" Offset="0.4091"/>
        <GradientStop Color="#FFF7F8F9" Offset="1"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="GridViewColumnHeaderBorderBackground" EndPoint="0,1" StartPoint="0,0">
        <GradientStop Color="#FFF2F2F2" Offset="0"/>
        <GradientStop Color="#FFD5D5D5" Offset="1"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="GridViewColumnHeaderHoverBackground" EndPoint="0,1" StartPoint="0,0">
        <GradientStop Color="#FFBDEDFF" Offset="0"/>
        <GradientStop Color="#FFB7E7FB" Offset="1"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="GridViewColumnHeaderPressBackground" EndPoint="0,1" StartPoint="0,0">
        <GradientStop Color="#FF8DD6F7" Offset="0"/>
        <GradientStop Color="#FF8AD1F5" Offset="1"/>
    </LinearGradientBrush>
    <Style x:Key="GridViewColumnHeaderGripper" TargetType="{x:Type Thumb}">
        <Setter Property="Canvas.Right" Value="-9"/>
        <Setter Property="Width" Value="18"/>
        <Setter Property="Height" Value="{Binding ActualHeight, RelativeSource={RelativeSource TemplatedParent}}"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="Background" Value="{StaticResource GridViewColumnHeaderBorderBackground}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border Background="Transparent" Padding="{TemplateBinding Padding}">
                        <Rectangle Fill="{TemplateBinding Background}" HorizontalAlignment="Center" Width="1"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="GridViewColumnHeaderStyle1" TargetType="{x:Type GridViewColumnHeader}">
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Background" Value="{StaticResource GridViewColumnHeaderBackground}"/>
        <Setter Property="BorderBrush" Value="{StaticResource GridViewColumnHeaderBorderBackground}"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Padding" Value="2,0,2,0"/>
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="MinWidth" Value="100" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
                    <Grid SnapsToDevicePixels="true">
                        <Border x:Name="HeaderBorder" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,1,0,1">
                            <Border Padding="{TemplateBinding Padding}">
                                <ContentPresenter x:Name="HeaderContent" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="0,0,0,1" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" RecognizesAccessKey="True"/>
                            </Border>
                        </Border>
                        <Border x:Name="HeaderHoverBorder" Margin="1,1,0,0" BorderThickness="1,0,1,1"/>
                        <Border x:Name="HeaderPressBorder" Margin="1,0,0,1" BorderThickness="1,1,1,0"/>
                        <Canvas>
                            <Thumb x:Name="PART_HeaderGripper" Style="{StaticResource GridViewColumnHeaderGripper}" />
                        </Canvas>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background" TargetName="HeaderBorder" Value="{StaticResource GridViewColumnHeaderHoverBackground}"/>
                            <Setter Property="BorderBrush" TargetName="HeaderHoverBorder" Value="#FF88CBEB"/>
                            <Setter Property="Background" TargetName="PART_HeaderGripper" Value="Transparent"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter Property="Background" TargetName="HeaderBorder" Value="{StaticResource GridViewColumnHeaderPressBackground}"/>
                            <Setter Property="BorderBrush" TargetName="HeaderHoverBorder" Value="#FF95DAF9"/>
                            <Setter Property="BorderBrush" TargetName="HeaderPressBorder" Value="#FF7A9EB1"/>
                            <Setter Property="Visibility" TargetName="PART_HeaderGripper" Value="Hidden"/>
                            <Setter Property="Margin" TargetName="HeaderContent" Value="1,1,0,0"/>
                        </Trigger>
                        <Trigger Property="Height" Value="Auto">
                            <Setter Property="MinHeight" Value="20"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Role" Value="Floating">
                <Setter Property="Opacity" Value="0.4082"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
                            <Canvas x:Name="PART_FloatingHeaderCanvas">
                                <Rectangle Fill="#FF000000" Width="{TemplateBinding ActualWidth}" Height="{TemplateBinding ActualHeight}" Opacity="0.4697"/>
                            </Canvas>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
            <Trigger Property="Role" Value="Padding">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
                            <Border x:Name="HeaderBorder" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,1,0,1"/>
                            <ControlTemplate.Triggers>
                                <Trigger Property="Height" Value="Auto">
                                    <Setter Property="MinHeight" Value="20"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </Style.Triggers>
    </Style>

</ResourceDictionary>